import { Space, Card, Typography } from "tdesign-react";
import HightLightCode from "@/components/HightLightCode";
import { stateDataCode } from "@/config";
import "../index.less";

const { Text, Title, Paragraph } = Typography;
const StateData = () => {
	return (
		<Card>
			<Space direction="vertical" style={{ width: "100%" }}>
				<Title level="h3">React State </Title>
				<Paragraph>
					State（状态）是 React 中用于管理组件内部数据的核心机制。与 Props 不同，State 是组件私有的、可变的，并且可以通过
					setState（类组件）或 Hooks（如 useState，函数组件）来更新。当 State 发生变化时，React 会重新渲染组件，以反映最新的 UI
					状态。
				</Paragraph>
				<Title level="h3">基本用法</Title>
				{stateDataCode.map((item, index) => {
					return (
						<Space direction="vertical" key={index}>
							<Title level="h5">{item.title}</Title>
							<Text>{item.introduce}</Text>
							<HightLightCode code={item.code} />
						</Space>
					);
				})}
			</Space>
		</Card>
	);
};

export default StateData;
